package com.carrental.service;

import java.util.List;

import com.carrental.dao.UserDao;
import com.carrental.entity.User;

//逻辑操作
public class UserService {

	UserDao userDao;
	
	public UserService() throws Exception {
		userDao = new UserDao();
	}
	
	//根据用户名和密码查询用户
	public User selectByNamePwd(String username, String password) throws Exception {
		return userDao.selectByNamePwd(username, password);
	}
	
	//根据用户名查询
	public User selectByUsername(String username) throws Exception {
		return userDao.selectByUsername(username);
	}
	
	//查询全部
	public List<User> selectAll() throws Exception {
		return userDao.selectAll();
	}
	
	//更新用户
	public int update(User user) throws Exception {
		return userDao.update(user);
	}
	
	//添加用户
	public int add(User user) throws Exception {
		return userDao.add(user);
	}
	
	//删除用户
	public int delete(String username) throws Exception {
		return userDao.delete(username);
	}
	
	
	
}
